<!-- <div event-click="{{'$Event.closeContent'}}" class="goodscontent {{isContent&&'focus'}}">
    <div class="back">
        <sbutton shadownum1="0 1px 4px 0" shadownum2="0 1px 8px 0" class="btn" text="返回"></sbutton>
    </div>
    <div class="detailcontent"></div>
</div> -->
<div class="checkAdd {{checkAdd&&'focus'}}">
    {{#if loginer}}
        <div>成功添加商品</div>
        <div>
            <a href="mobile.main.html#default/cart"><button>转到购物车</button></a>
            <button>留在此页</button>
        </div>
    {{#else}}
        <div>您还未登陆</div>
        <div>
            <a href="mobile.main.html#default/sign_in?cb_url=1"><button>去登陆</button></a>
            <button event-click="{{'$Event.checkAdd'}}">取消</button>
        </div>
    {{/if}}
</div>
{{#if goods_detail}}
<div class="goods_details">
    {{#> "goodsimgview"}}
    <div class="goodsinfo">
        <div class="titlebar">
            商品信息
            <div class="i icon-sina-weibo" event-click="{{'$Event.shareToWeibo'}}"></div>
                <div class="i icon-qq" event-click="{{'$Event.shareQzone'}}"></div>
        </div>
        <hr />
        <div class="infobox">
            <div class="intro">
                {{#if goods_detail.intro}}
                    {{goods_detail.intro}}
                {{/if}}
                {{#if goods_detail.detail_content}}
                    <!-- <div><sbutton class="btn" shadownum1="0 1px 4px 0" shadownum2="0 1px 8px 0" text="查看更多详情" event-click="{{'$Event.open_goods_content'}}"></sbutton></div> -->
                {{#else}}
                <p>此商品没有添加详细描述</p>
                {{/if}}
            </div>
        </div>
        <hr />
        <div class="saleinfo">
            <div class="item">状态：{{#if goods_detail.num==0}}缺货{{#else}}有货（{{goods_detail.num}}）{{/if}}</div>
            <div class="item">销量：{{goods_detail.sale_num}}</div>
        </div>
    </div>
    <div class="bottomblock"></div>
    <div class="floatbtnbox">
        <!-- <a event-click="{{'$Event.closeContent'}}"><div class="back {{isContent&&'focus'}}">返回</div></a> -->
        <!-- 数量： -->
        <!-- <input class="num" type="text" value="1" bind-input="{{'$Cache.goods_details.buy_number'}}" /> -->
        <a class="one">
            <span class="price">￥{{goods_detail.price_toFixed_2}}</span>/{{goods_detail.unit}}
        </a>
        <a class="buy" event-click="{{'$Event.goods.add_to_cart'}}" event-click-new="{{'$Event.checkAdd'}}">
        <div class="icon-cart2"></div>
        <div class="method">
        {{#if goods_detail.num }}
            <!-- <sbutton shadownum1="0 0 10px 2px" shasownum2="0 0 6px 2px" class="btn" event-click="{{'$Event.goods.add_to_cart'}}" text="加入购物车" event-click-new="{{'$Event.checkAdd'}}"></sbutton> -->
            加入购物车
        {{#else}}
            <!-- <sbutton shadownum1="0 0 10px 2px" shasownum2="0 0 6px 2px" class="btn disabled" disabled="true" text="暂时缺货"></sbutton> -->
            暂时缺货
        {{/if}}
        </div>
        </a>
    </div>
</div>
{{#else}}
<center style="
    display: block;
    width: 100%;
    height: 100%;
    position: absolute;
"><p style="
    margin-top: 50%;
"> 商品详情加载中 <br><span class="icon-spinner"></span></p></center>
{{/if}}

<xmp type="template" name="goodsimgview">
    <div class="goodsimg">
        <div class="bigbox">
            <div class="movebox">
                {{#if goods_detail.detail_img_urls.length}}
                {{#each goods_detail.detail_img_urls}}
                <img class="bigimg" bind-src="{{$This}}" />
                {{/each}} {{#else}}
                <img class="bigimg" bind-src="{{goods_detail.preview_img_url||'images/imgerror.jpg'}}" />
                {{/if}}
            </div>
            <div class="pricebox">
                <div class="itemleft"><!-- ￥{{goods_detail.price_toFixed_2+"/"+goods_detail.unit}} --></div>
                <div class="itemright">
                    <a event-click="{{'$Event.goods.collect_toggle'}}" class="{{$Cache.goods_detail.is_collect&&'icon-star3'||'icon-star'}}">{{$Cache.goods_detail.is_collect&&'已收藏'||'点击收藏'}}</a>
                </div>
            </div>
        </div>
        <div class="smallbox">
            {{#if goods_detail.detail_img_urls.length}} {{#each goods_detail.detail_img_urls }}
            <img name="{{$Index}}" class="smallimg" bind-src="{{$This}}?imageView/1/w/50/h/50" />{{/each}} {{#else}}此商品卖家没有上传图片{{/if}}
        </div>
    </div>
    <script type="text/vm">
        function(vm) {
            var movebox = vm.queryElement({
                className: "movebox"
            })[0];
            var smallbox = vm.queryElement({
                className: "smallbox"
            })[0];
            require(['jQuery'], function() {
                var $movebox = $(movebox);
                $(smallbox).on("click", "img", function() {
                    var w = $movebox.width();
                    $movebox.stop().animate({
                        marginLeft: -w * $(this).attr('name')
                    }, 350);
                })
            })
        }
    </script>
</xmp>